package com.fausto.learnimprint.message.consumer

import com.fausto.learnimprint.log.controller.ControllerLog
import com.fausto.learnimprint.log.controller.ControllerLogDAO
import com.fausto.learnimprint.message.MqConstant
import org.springframework.amqp.rabbit.annotation.RabbitHandler
import org.springframework.amqp.rabbit.annotation.RabbitListener
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component

@Component
@RabbitListener(queues = [MqConstant.CONTROLLER_LOG_QUEUE])
class ControllerLogListener {

    @Autowired
    lateinit var controllerLogDAO: ControllerLogDAO

    @RabbitHandler
    fun save(log: ControllerLog){
        controllerLogDAO.saveControllerLog(log)
    }
}